local jingce = fk.CreateSkill({
    name = "sj4__jingce",
  })
  
  Fk:loadTranslationTable{
    ["sj4__jingce"] = "精策",
    [":sj4__jingce"] = "结束阶段，你可以视为使用展示<a href='zhongyangqu_js'>中央区</a>的"..
    "<a href=':sanshe__enemy_at_the_gates'>【兵临城下】</a>，令下个从牌堆获得【杀】的角色摸三张牌。",
  
    ["#sj4__jingce"] = "精策：你可以视为使用亮出中央区的【兵临城下】",
    
  
    ["$sj4__jingce1"] = "方策精详，有备无患。",
    ["$sj4__jingce2"] = "精兵据敌，策守如山。",
  }

  jingce:addEffect(fk.EventPhaseStart, {
    can_trigger = function(self, event, target, player, data)
      return player:hasSkill(jingce.name) and target == player and
      player.phase == Player.Finish --回合结束
      and #player:getTableMark("sj4__jingce-turn") > 0 --中央区需要有牌
    end,
    on_cost = function (self, event, target, player, data)
      local use = player.room:askToUseVirtualCard(player,{
        name = "sanshe__enemy_at_the_gates",
        skill_name = jingce.name,
        prompt = "#sj4__jingce",
        skip = true
      })
      event:setCostData(self,{use = use})
      return use ~= nil
    end,
    on_use = function(self, event, target, player, data)
      local use = event:getCostData(self).use
      use.extra_data = {ids = player:getTableMark("sj4__jingce-turn"), toArea = "top"}
      player.room:useCard(use)
      player.room:setPlayerMark(player,jingce.name,1)
    end,
  })

  jingce:addEffect(fk.AfterCardsMove, {
  can_refresh = function(self, event, target, player, data)
    if player:hasSkill(jingce.name, true) then
      for _, move in ipairs(data) do
        if move.toArea == Card.DiscardPile then
          for _, info in ipairs(move.moveInfo) do
            if table.contains(player.room.discard_pile, info.cardId) then
              return true
            end
          end
        end
        for _, info in ipairs(move.moveInfo) do
          if info.fromArea == Card.DiscardPile and not table.contains(player.room.discard_pile, info.cardId) then
            return true
          end
        end
      end
    end
  end,
  on_refresh = function(self, event, target, player, data)
    local room = player.room
    local ids = player:getTableMark("sj4__jingce-turn")
    for _, move in ipairs(data) do
      if move.toArea == Card.DiscardPile then
        for _, info in ipairs(move.moveInfo) do
          if table.contains(room.discard_pile, info.cardId) then
            table.insertIfNeed(ids, info.cardId)
          end
        end
      end
      for _, info in ipairs(move.moveInfo) do
        if info.fromArea == Card.DiscardPile and not table.contains(room.discard_pile, info.cardId) then
          table.removeOne(ids, info.cardId)
        end
      end
    end
    room:setPlayerMark(player, "sj4__jingce-turn", ids)
  end,
  })

  jingce:addEffect(fk.AfterCardsMove, {
    can_trigger = function(self, event, target, player, data) --data类型CardsMoveInfo
      for _, move in ipairs(data) do
        if move.moveReason == fk.ReasonDraw and 
        (table.find(move.moveInfo,function (info)
            return Fk:getCardById(info.cardId).trueName == "slash"
          end) ~= nil and move.to) then--从牌堆摸到杀
            for _, t in ipairs(player.room:getAlivePlayers()) do
              if t:getMark(jingce.name) > 0 then
                player.room:setPlayerMark(t,jingce.name,0)--去掉标记
                t:broadcastSkillInvoke(jingce.name)
                return true
              end
            end
        end
      end
    end,
    on_cost = Util.TrueFunc,
    on_use = function(self, event, target, player, data)
      player.room:drawCards(player,3,jingce.name)
    end,
  })

  return jingce